package com.example.demo.optional;

import cn.hutool.core.util.ObjectUtil;
import com.example.demo.mode.Address;
import com.example.demo.mode.Employee;
import com.example.demo.mode.User;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author pengyifeng
 * @version 5.0
 * @ClassName Test.java
 * @Description TODO
 * @createTime 2021年04月21日 11:27:00
 */
public class Test {

    public static void main(String[] args){

        Employee employee=new Employee();
        employee.setAge(11);
        employee.setName("zs");
        employee.setSalary(new BigDecimal(1000));
        List<User> userList=new ArrayList<>();
        User user=new User();
        user.setAge(10);
        Address address=new Address();
        address.setCity("ss");
        user.setAddress(address);
        userList.add(user);
        employee.setUsers(userList);
        Employee clone = ObjectUtil.clone(employee);
        System.out.println(clone);

        Employee employee1 = ObjectUtil.cloneByStream(employee);
        System.out.println(employee1);

    }
}
